package com.mike.dao.impl;

import org.hibernate.Query;
import org.hibernate.Session;
import org.springframework.stereotype.Repository;

import com.mike.dao.BaseDao;
import com.mike.dao.t_userDao;
import com.mike.pojo.T_user;

@Repository
public class t_userDaoImpl extends BaseDao implements t_userDao {

	@Override
	public int  query(T_user t_user) {
		Session session = getSession();
		 String hql="SELECT COUNT(*) FROM T_user WHERE NAME=? AND PASSWORD=?";//此处的Product是对象
		 Query query = session.createQuery(hql).setParameter(0, t_user.getName()).setParameter(1, t_user.getPassword());
		 
		int count=((Long) query.setCacheable(true).uniqueResult()).intValue();//此处用Long类型进行转换
		
		session.close();
		
		return count;

		
	}
}
